import constants from "../utils/constants";
export function getUserInfo(code) {
  return new Promise((resolve) => {
    wx.request({
      url:constants.database + '/user/user/login',
      method:'POST',
      data:{
        code:code
      },
      success:(res)=>{
        resolve(res)
      }
    })
  })
}

export function getAllUserInfo(token){
  return new Promise((resolve) => {
    wx.request({
      url:constants.database + '/user/user/getMessage',
      method:'GET',
      header:{
        'Content-Type': 'application/json',
        'authentication': token
      },
      success:(res)=>{
        resolve(res)
      }
    })
  })
}

export function changeUserBaseInfo(userBaseInfo,token){
  console.log(userBaseInfo);
  wx.request({
    url:constants.database + '/user/user/update',
    method:'PUT',
    data:userBaseInfo,
    header:{
        'Content-Type': 'application/json',
        'authentication': token
      },
  })
}